package com.eascs.web.o2o.mq.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;

import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;
import com.eascs.web.o2o.mq.dao.RabbitMqDao;
import com.eascs.web.o2o.mq.entity.LogEntity;

public abstract class TransAbstractService {
	
	private static final Logger logger = LoggerFactory.getLogger(TransAbstractService.class);

	
	@Autowired
	private RabbitMqDao rabbitMqDao;



	public void writeLog(String appno, String loanapplyNo, String billCode, int resultType,
			String resultDesc) {
		try {
			LogEntity saveEntity = new LogEntity();
			saveEntity.setAppNo(appno);
			saveEntity.setLoanapplyNo(loanapplyNo);
			saveEntity.setBillCode(billCode);
			saveEntity.setResultType(resultType);
			saveEntity.setResultDesc(resultDesc);
			saveEntity.setEndTime(new Date());
			logger.info("保存日志信息:[{}]", saveEntity.toString());
			rabbitMqDao.insertForService(saveEntity);
		} catch (Exception e) {
			logger.error("保存日志信息异常:[{}]", e.getMessage());
			e.printStackTrace();
		}
	}
}
